//
//  UIView+Category.m
//  RealmeLink
//
//  Created by lkx on 2020/8/14.
//  Copyright © 2020 chewyong. All rights reserved.
//

#import "UIView+Category.h"


@implementation UIView (Category)

/// 设置圆角及边框
/// @param cornerRadius 圆角弧度
/// @param borderColor 边框颜色
/// @param borderWidth 边框大小
- (void)setCornerRadius:(CGFloat)cornerRadius
            borderColor:(UIColor *)borderColor
            borderWidth:(CGFloat)borderWidth {
    self.layer.cornerRadius = cornerRadius;
    self.layer.borderWidth = borderWidth;
    self.layer.borderColor = borderColor.CGColor;
}
- (void)addRoundedCorners:(UIRectCorner)corners
                withRadii:(CGSize)radii {
    
    UIBezierPath* rounded = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:radii];
    CAShapeLayer* shape = [[CAShapeLayer alloc] init];
    [shape setPath:rounded.CGPath];
    
    self.layer.mask = shape;
}
@end
